#ifndef _DRV_REGS_H
#define _DRV_REGS_H

#include "DSP2833x_Device.h"     // DSP2833x Headerfile Include File
#include "define.h"

struct _AnalogData
{
	Uint16 GND1;
	Uint16 MOTOR_U;
	Uint16 MOTOR_I;
	Uint16 GND2;
	Uint16 Temperate;
};union AnalogData
{
	Uint16 ItemArray[VAL_ANA_SIZE];
	struct _AnalogData Items;
};


struct SysData
{
	Uint16 			PeriodFlg;
	Uint16 			SoftVer[4];
	union 			AnalogData AnalogData;
};

struct PluseGen
{
	Uint16 Base;
	Uint32 PluseCnt;
	int16 CurrentRdc;
	Uint32 RdcRoundCnt;
};


union ControlReg
{
	struct
	{
		Uint16 MotorEn:1;
		Uint16 MotorDir:1;
		Uint16 rsv:14;
	} bit;
	Uint16 all;
};
union ErrStateReg
{
	struct
	{
		Uint16 MotorUUnder:1;
		Uint16 MotorIOver:1;
		Uint16 SpeedOver:1;
		Uint16 rsv:13;
	} bit;
	Uint16 all;
};
struct  DRV_REGS
{
    Uint16 MotorV;
    Uint16 MotorA;
    int16 SpeedFeed;
    Uint16 DrvState;
    Uint16 Pwm;
    union ErrStateReg ErrState;
    Uint16 MotorOverI;
    Uint16 Mode;
    Uint16 CommPeriod;
    Uint16 SpeedRef;
    union ControlReg Control;
    Uint16 MotorUnderV;
    int16 Temperate;
};




extern struct DRV_REGS g_CanMsg;
extern struct SysData g_SysData;
extern struct PluseGen g_PlusGen;
#endif

